<?php 
namespace Home\Controller; 
use Hdphp\Controller\Controller;
use Common\Model\Category;
use Common\Model\Tag;
use Common\Model\Link;
use Common\Model\Article;
/**
 *
 * 公共控制器
 */
class CommonController extends Controller{

	//构造函数
	public function __init(){
		//文章
		$articleModel=new Article;
		//分类
		$cateModel= new Category;
		//获取顶级分类
		$category=$cateModel->where('pid',0)->get();
		View::with('category',$category);


		//个人日记
		$article=$articleModel->join('category','cid','=','category_cid')->where('pid',1)->orderBy('click','DESC')->limit(4)->get();
		// var_dump($article);die;
		View::with('article',$article);

		//标签
		$tagModel= new Tag;
		$tag=$tagModel->get();
		View::with('tag',$tag);

		//友情链接
		$linkModel= new Link;
		$link=$linkModel->limit(4)->get();
		View::with('link',$link);


	}
	
 
}













?>